home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Boxes.pxl
< prev
next >
Wrap
Text File
|
2000-12-23
|
24KB
|
791 lines
{-------------- sample PiXCL source code ------------------------}
{ ---- can be freely copied in your programs --------------------}
Initialize:
AppWindowHandle(h,h$,geoflag,PiXCLMajor,PiXCLMinor)
WinGetActive(Win$)
UseCoordinates(PIXEL)
UseBackGround(TRANSPARENT,192,192,192)
DrawBackGround
WaitInput(100) {let NT and 95 catch up}
InfoMenu(REMOVE)
SetMenu()
WinLocate(Win$,200,100,700,620,Res)
Title$ = "2D Drawing and Frame Controls"
WinTitle(Win$, Title$)
DirGet(SourceDir$)
Flag = 0
SetMenu("Exit!",Leave,
ENDPOPUP,
"Test",IGNORE,
"Modulus",TestModulus,
"Random",RandNum,
ENDPOPUP,
"2D Drawing",IGNORE,
"Fast Draw",FastDraw,
SEPARATOR,
"BoxesR",DrawBoxesR,
"BoxesP",DrawBoxesP,
"Ellipses",DrawEllipses,
"Triangles",DrawTriangles,
"Polygons",DrawPolygons,
"Stars",DrawStars,
"MapleLeaves 1",DrawMapleLeaf1,
"MapleLeaves 2",DrawMapleLeaf2,
"Images",DrawImages,
"Line Style 1",DrawLines,
"Line Style 2",DrawLines2,
"Bouncing Shapes",DrawBounce,
SEPARATOR,
"DrawCapt",Captions,
SEPARATOR,
"Mouse Draw ON",Mouse_DrawOn,
"MouseDraw OFF",Mouse_DrawOff,
"MemDC",ReDrawMemoryDC,
SEPARATOR,
"Choose Color",GetColor,
ENDPOPUP,
"Frame Controls",IGNORE,
"Button",Control_Button,
"Caption",Control_Caption,
"Menu",Control_Menu,
"Scroll",Control_Scroll,
"Show All",Control_All,
ENDPOPUP,
"Help",IGNORE,
"2D Drawing",GDIDemoHelp,
"SetDrawMouse",DrawMouseHelp,
"View Source",ViewSource,
SEPARATOR,
"WinHelp",GetHelp,
"AboutPiXCL",About,
ENDPOPUP)
StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
i = 0
FastDrawFlag = 0
UseBrush(SOLID,128,128,255)
Wait_for_Input:
WaitInput()
Leave:
End
FastDraw:
If FastDrawFlag = 0
FastDrawFlag = 1
ChangeMenuItem("Fast Draw",CHECK,Res)
DrawStatusWinText(0,"Fast 2D Draw mode")
Else
FastDrawFlag = 0
ChangeMenuItem("Fast Draw",UNCHECK,Res)
DrawStatusWinText(0,"Slow 2D Draw mode")
Endif
Goto Wait_for_Input
GDIDemoHelp:
MessageBox(OK,1,INFORMATION,
"The 2D drawing menu top item 'Fast Draw' sets a flag that
inserts a 64mS delay after each vector or polygon is drawn.
Clicking the left mouse in the client area will stop the
draw operations, clear the screen and report the number
of polygons or vectors drawn. You can also select any menu
item. You will notice a delay in the menu item selecting:
this is because the PiXCL script checks for input every
50 vectors. This delay can be changed in the PXL source
file if you want.
DrawPolygon and DrawTriangle operations are faster than
DrawEllipse.",
"2D Drawing Options",Res)
Goto Wait_for_Input
DrawMouseHelp:
MessageBox(OK,1,INFORMATION,
"If you start a 2D drawing operation - boxes, ellipses,
polygons or lines - you can stop the draw process without
clearing the background with the 'Mouse Draw On' command.
You can select any of the colors for drawing with the
mouse in the client area by using a Ctrl-Left Mouse click
on a pixel of the desired color. Holding the left mouse
button down will then draw in the selected color as you
move.
To clear the draw mouse, click the right mouse. This is
not the default action, only how the sample program was
written. You could just as easily use the ShiftRightMouse
or a keyboard entry.",
"Set Draw Mouse Help",Res)
Goto Wait_for_Input
ViewSource:
PXL_file$ = SourceDir$ + "\boxes.pxl"
CmdLine$ = "Notepad " + PXL_file$
WinShow(Title$,NOTOPMOST,Res)
Run(CmdLine$)
Goto Wait_for_Input
GetColor:
GetPixel(X,Y,R,G,B,Res)
UsePen(SOLID,3,R,G,B)
Goto Wait_for_Input
Mouse_DrawOn:
DrawStatusWinText(1,"Mouse Drawing enabled.")
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetCtrlMouse(cx1,cy1,cx2,cy2,DrawBlock,X,Y)
SetRightMouse(cx1,cy1,cx2,cy2,ReDrawMemoryDC,n,n)
SetCtrlMouse(cx1,cy1,cx2,cy2,GetColor,X,Y)
SetMouse()
SetDrawMouse(FOREGND)
DrawLine(10,10,100,10)
Goto Wait_for_Input
Mouse_DrawOff:
DrawStatusWinText(1,"Mouse Drawing disabled.")
SetDrawMouse(DISABLE)
SetRightMouse()
Goto Wait_for_Input
ReDrawMemoryDC:
ReDraw
Goto Wait_for_Input
DrawBlock:
X1 = X - 15 X2 = X + 15
Y1 = Y - 15 Y2 = Y + 15
DrawRectangle(X1,Y1,X2,Y2)
Goto Wait_for_Input
About:
AboutPiXCL
AboutUser("PiXCL Tools Sample Program",
"Windows 2D Draw, Frame Controls and WinHelp access.",
"A variety of shapes can be drawn in fast mode or slow
mode which waits 64mS between each draw operation.
Click the left mouse in the client area to stop.
Frame controls can be drawn any size or position.")
Goto Wait_for_Input
Control_Button:
DrawStatusWinText(1,"Frame controls built into PiXCL.")
DrawBackground
DrawFrameControl(0,0,40,40,BUTTONRADIO,INACTIVE,Res)
DrawFrameControl(50,0,90,40,BUTTONPUSH,INACTIVE,Res)
DrawFrameControl(100,0,140,40,BUTTON3STATE,INACTIVE,Res)
DrawFrameControl(150,0,190,40,BUTTONCHECK,INACTIVE,Res)
SetMouse(0,0,40,40,Ctl,X,Y)
SetRightMouse(0,0,40,40,Ctr,X,Y)
Goto Wait_for_Input
Ctl:
DrawFrameControl(0,0,40,40,BUTTONRADIO,PUSHED,Res)
Goto Wait_for_Input
Ctr:
DrawFrameControl(0,0,40,40,BUTTONRADIO,CHECKED,Res)
Goto Wait_for_Input
Control_Caption:
DrawStatusWinText(1,"Caption control built into PiXCL.")
DrawBackground
DrawFrameControl(0,0,40,40,CAPTIONCLOSE,CHECKED,Res)
DrawFrameControl(50,0,90,40,CAPTIONHELP,FLAT,Res)
DrawFrameControl(100,0,140,40,CAPTIONMAX,INACTIVE,Res)
DrawFrameControl(150,0,190,40,CAPTIONMIN,MONO,Res)
DrawFrameControl(200,0,240,40,CAPTIONRESTORE,PUSHED,Res)
Goto Wait_for_Input
Control_Menu:
DrawStatusWinText(1,"Frame controls built into PiXCL.")
DrawBackground
DrawFrameControl(0,0,40,40,MENUARROW,CHECKED,Res)
DrawFrameControl(50,0,90,40,MENUBULLET,FLAT,Res)
DrawFrameControl(100,0,140,40,MENUCHECK,INACTIVE,Res)
DrawFrameControl(150,0,190,40,MENUARROW,MONO,Res)
DrawFrameControl(200,0,240,40,MENUARROW,PUSHED,Res)
Goto Wait_for_Input
Control_Scroll:
DrawStatusWinText(1,"Frame controls built into PiXCL.")
DrawBackground
DrawFrameControl(0,0,40,40,SCROLLCOMBOBOX,CHECKED,Res)
DrawFrameControl(50,0,90,40,SCROLLDOWN,FLAT,Res)
DrawFrameControl(100,0,140,40,SCROLLLEFT,INACTIVE,Res)
DrawFrameControl(150,0,190,40,SCROLLRIGHT,MONO,Res)
DrawFrameControl(200,0,240,40,SCROLLSIZEGRIP,PUSHED,Res)
DrawFrameControl(250,0,290,40,SCROLLUP,PUSHED,Res)
Goto Wait_for_Input
Control_All:
DrawStatusWinText(1,"Frame controls built into PiXCL.")
DrawBackground
DrawFrameControl(0,0,40,40,BUTTONRADIO,INACTIVE,Res)
DrawFrameControl(50,0,90,40,BUTTONPUSH,INACTIVE,Res)
DrawFrameControl(100,0,140,40,BUTTON3STATE,INACTIVE,Res)
DrawFrameControl(150,0,190,40,BUTTONCHECK,INACTIVE,Res)
DrawFrameControl(0,50,40,90,CAPTIONCLOSE,CHECKED,Res)
DrawFrameControl(50,50,90,90,CAPTIONHELP,FLAT,Res)
DrawFrameControl(100,50,140,90,CAPTIONMAX,INACTIVE,Res)
DrawFrameControl(150,50,190,90,CAPTIONMIN,MONO,Res)
DrawFrameControl(200,50,240,90,CAPTIONRESTORE,PUSHED,Res)
DrawFrameControl(0,100,40,140,MENUARROW,CHECKED,Res)
DrawFrameControl(50,100,90,140,MENUBULLET,FLAT,Res)
DrawFrameControl(100,100,140,140,MENUCHECK,INACTIVE,Res)
DrawFrameControl(150,100,190,140,MENUARROW,MONO,Res)
DrawFrameControl(200,100,240,140,MENUARROW,PUSHED,Res)
DrawFrameControl(0,150,40,190,SCROLLCOMBOBOX,CHECKED,Res)
DrawFrameControl(50,150,90,190,SCROLLDOWN,FLAT,Res)
DrawFrameControl(100,150,140,190,SCROLLLEFT,INACTIVE,Res)
DrawFrameControl(150,150,190,190,SCROLLRIGHT,MONO,Res)
DrawFrameControl(200,150,240,190,SCROLLSIZEGRIP,PUSHED,Res)
DrawFrameControl(250,150,290,190,SCROLLUP,PUSHED,Res)
UseFont("Arial",6,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawText(200,5,"Button Controls")
DrawText(250,55,"Caption Controls")
DrawText(250,105,"Menu Controls")
DrawText(300,155,"Scroll Controls")
Goto Wait_for_Input
Captions:
DrawCaption("",10, 0,150, 30, ICON,COLOR,INBUTTON,Res)
DrawCaption("",10, 30,150, 55, ICON,COLOR,NOINBUTTON,Res)
DrawCaption("",10, 60,150, 85,NOICON,COLOR,NOINBUTTON,Res)
DrawCaption("",10, 90,150,115,NOICON,SMALLCAP,INBUTTON,Res)
DrawCaption("",10,120,150,145,NOICON,SMALLCAP,NOINBUTTON,Res)
UseFont("Arial",6,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawText(155,5,"ICON,COLOR,INBUTTON")
DrawText(155,35,"ICON,COLOR,NOINBUTTON")
DrawText(155,65,"NOICON,COLOR,NOINBUTTON")
DrawText(155,95,"NOICON,SMALLCAP,INBUTTON")
DrawText(155,125,"NOICON,SMALLCAP,NOINBUTTON")
Goto Wait_for_Input
GetHelp:
DrawStatusWinText(1,"Using the WinHelp command.")
HelpFile$ = SourceDir$ + "\pixclhlp.hlp"
WinHelp(HelpFile$,CONTENTS,"")
Goto Wait_for_Input
TestModulus:
DrawStatusWinText(1,"Getting a modulus number.")
DrawBackGround Flag = 0
DrawText(10,3,"Modulus 10 operations")
Random(1000,J)
DrawNumber(10,20, J)
K = J % 10 DrawNumber(10,45, K)
Negate(K) DrawNumber(50,45, K)
Goto Wait_for_Input
RandNum:
DrawStatusWinText(1,"Generating random numbers")
DrawBackGround Flag = 0
Random(1000,Ran1) DrawNumber(10,10,Ran1)
Random(255,Ran2) DrawNumber(10,35,Ran2)
Goto Wait_for_Input
DrawBoxesR:
DrawStatusWinText(1,"Drawing random size and position boxes.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Loop1:
Random(cx2,X1) Random(cy2,Y1)
Random(128,Xsize) Random(128,Ysize)
Random(255,R) Random(255,G) Random(255,B)
X2 = X1 + Xsize Y2 = Y1 + Ysize
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
DrawRectangle(X1,Y1,X2,Y2)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random size and position boxes.")
If j = 0
WaitInput(1)
Str(i,i$)
i$ = i$ + " 2D draw operations"
DrawStatusWintext(1,i$)
Endif
Goto Loop1
DrawBoxesP:
DrawStatusWinText(1,"Drawing random size and position boxes.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Loop1a:
Random(cx2,X1) Random(cy2,Y1)
Random(128,Xsize) Random(128,Ysize)
Random(255,R) Random(255,G) Random(255,B)
X2 = X1 + Xsize Y2 = Y1
X3 = X1 + Xsize Y3 = Y1 + Ysize
X4 = X1 Y4 = Y1 + Ysize
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random size and position boxes.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " 2D draw operations"
DrawStatusWintext(1,i$)
Endif
Goto Loop1a
DrawEllipses:
DrawStatusWinText(1,"Drawing random size and position ellipses.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Loop2:
Random(1000,X1) Random(768,Y1)
Random(128,Xsize) Random(192,Ysize)
Random(255,R) Random(255,G) Random(255,B)
X2 = X1 + Xsize Y2 = Y1 + Ysize
UsePen(SOLID,1,R,G,B)
UseBrush(SOLID,R,G,B)
DrawEllipse(X1,Y1,X2,Y2)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random size and position ellipses.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " polygons drawn"
DrawStatusWintext(1,i$)
Endif
Goto Loop2
DrawTriangles:
DrawStatusWinText(1,"Drawing random size and position triangles.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Loop2a:
Random(cx2,X1) Random(cy2,Y1)
Random(cx2,X2) Random(cy2,Y2)
Random(cx2,X3) Random(cy2,Y3)
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,R,G,B)
UseBrush(SOLID,G,B,R)
DrawTriangle(X1,Y1,X2,Y2,X3,Y3)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random size and position triangles.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " triangles drawn"
DrawStatusWintext(1,i$)
Endif
Goto Loop2a
DrawImages:
DrawStatusWinText(1,"Drawing random size and position images.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
Image$ = SourceDir$ + "\1iddnext.bmp"
DrawStatusWinText(0,"Click client area to stop")
Loop3:
Random(1000,X1) Random(768,Y1)
Random(500,Xsize) Random(340,Ysize)
X2 = X1 + Xsize Y2 = Y1 + Ysize
DrawSizedBitMap(X1,Y1,X2,Y2,Image$)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random size and position images.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " 2D draw operations"
DrawStatusWintext(1,i$)
Endif
Goto Loop3
DrawLines:
DrawStatusWinText(1,"Drawing random length and position lines.")
If Flag = 0 Then DrawBackGround Flag = 1
UsePen(SOLID,2,255,255,255)
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Loop4:
Random(cx2,X1) Random(cy2,Y1)
Random(cx2,X2) Random(cy2,Y2)
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,2,R,G,B)
DrawLine(X1,Y1,X2,Y2)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random length and position lines.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " 2D draw operations"
DrawStatusWintext(1,i$)
Endif
Goto Loop4
DrawLines2:
DrawStatusWinText(1,"Drawing bouncing lines.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
X1 = 100 Y1 = 100
X2 = X1 + 128 Y2 = Y1 + 128
IncrX1 = 1 IncrY1 = 2
IncrX2 = 4 IncrY2 = 6
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,R,G,B)
ColorFlag = 0
Loop5:
k = i % 1000
DrawLine(X1,Y1,X2,Y2)
If FastDrawFlag = 0 Then WaitInput(1)
X1 = X1 + IncrX1 Y1 = Y1 + IncrY1
X2 = X2 + IncrX2 Y2 = Y2 + IncrY2
If X1 <= cx1 Then Negate(IncrX1) ColorFlag = 1
If X1 >= cx2 Then Negate(IncrX1)
If X2 >= cx2 Then Negate(IncrX2) ColorFlag = 1
If X2 <= cx1 Then Negate(IncrX2)
If Y2 >= cy2 Then Negate(IncrY2) ColorFlag = 1
If Y2 <= cy1 Then Negate(IncrY2)
If Y1 <= cy1 Then Negate(IncrY1) ColorFlag = 1
If Y1 >= cy2 Then Negate(IncrY1)
{
R = R + 5 If R >= 255 Then R = 0
G = G + 5 If G >= 255 Then G = 0
B = B + 5 If B >= 255 Then B = 0
}
If ColorFlag = 1
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,R,G,B)
ColorFlag = 0
Endif
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing bouncing lines.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " 2D draw operations"
DrawStatusWintext(1,i$)
Endif
Goto Loop5
DrawBounce:
DrawStatusWinText(1,"Drawing bouncing boxes and ellipses.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Random(cx2,X1) Random(cy2,Y1)
X2 = X1 + 48 Y2 = Y1 + 48
IncrX = 12 IncrY = 12
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,2,R,G,B)
UseBrush(SOLID,B,R,G)
ColorFlag = 0
Loop6:
k = i % 1000
If k <= 500 Then DrawEllipse(X1,Y1,X2,Y2)
If k > 500 Then DrawRectangle(X1,Y1,X2,Y2)
If FastDrawFlag = 0 Then WaitInput(1)
X1 = X1 + IncrX Y1 = Y1 + IncrY
X2 = X1 + 48 Y2 = Y1 + 48
If X2 > cx2 Then Negate(IncrX) ColorFlag = 1
If X1 < cx1 Then Negate(IncrX) ColorFlag = 1
If Y2 > cy2 Then Negate(IncrY) ColorFlag = 1
If Y1 < cy1 Then Negate(IncrY) ColorFlag = 1
R = R + 5 If R >= 255 Then R = 0
G = G + 5 If G >= 255 Then G = 0
B = B + 5 If B >= 255 Then B = 0
UseBrush(SOLID,R,G,B)
If ColorFlag = 1
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
ColorFlag = 0
Endif
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing bouncing boxes and ellipses.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " 2D draw operations"
DrawStatusWintext(1,i$)
Endif
Goto Loop6
DrawPolygons:
DrawStatusWinText(1,"Drawing random 9 vertex polygons.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
If PiXCLMajor = 4
Loop7:
Random(cx2,X1) Random(cy2,Y1)
Random(cx2,X2) Random(cy2,Y2)
Random(cx2,X3) Random(cy2,Y3)
Random(cx2,X4) Random(cy2,Y4)
Random(cx2,X5) Random(cy2,Y5)
Random(cx2,X6) Random(cy2,Y6)
Random(cx2,X7) Random(cy2,Y7)
Random(cx2,X8) Random(cy2,Y8)
Random(cx2,X9) Random(cy2,Y9)
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,R,G,B)
UseBrush(SOLID,G,B,R)
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9)
If FastDrawFlag = 0 Then WaitInput(1)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random 9 vertex polygons.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " polygons drawn"
DrawStatusWintext(1,i$)
Endif
Goto Loop7
Else
FreeArrayVarAll
Array(ArrayOfPoints[80],Size)
i = 0
Loop7a:
For k = 0 To 79
Random(cx2,ArrayOfPoints[k] )
Next
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,R,G,B)
UseBrush(SOLID,G,B,R)
DrawPolygonExt(40,ArrayOfPoints[0],Res)
If FastDrawFlag = 0 Then WaitInput(600)
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing random 40 vertex polygons.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " polygons drawn"
DrawStatusWintext(1,i$)
Endif
Goto Loop7a
Endif
DrawStars:
DrawStatusWinText(1,"Drawing bouncing five point stars.")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Random(cx2,ctX1) Random(cy2,ctY1)
IncrX = 12 IncrY = 12
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,R,G,B)
UseBrush(SOLID,B,R,G)
ColorFlag = 0
GoSub UpDateStarCoords
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5)
Loop8:
GoSub UpDateStarCoords
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5)
If FastDrawFlag = 0 Then WaitInput(1)
ctX1 = ctX1 + IncrX ctY1 = ctY1 + IncrY
If ctX1 < cx1 Then Negate(IncrX) ColorFlag = 1
If ctY1 < cy1 Then Negate(IncrY) ColorFlag = 1
If ctX1 > cx2 Then Negate(IncrX) ColorFlag = 1
If ctY1 > cy2 Then Negate(IncrY) ColorFlag = 1
R = R + 5 If R >= 255 Then R = 0
G = G + 5 If G >= 255 Then G = 0
B = B + 5 If B >= 255 Then B = 0
UseBrush(SOLID,R,G,B)
If ColorFlag = 1
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
ColorFlag = 0
Endif
i = i + 1 j = i % 50
If j = 5 Then DrawStatusWinText(1,"Drawing bouncing five point stars.")
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " polygons drawn"
DrawStatusWintext(1,i$)
Endif
Goto Loop8
DrawMapleLeaf1:
DrawStatusWinText(1,"Maple leaves ... hey, we're Canadian !")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Random(cx2,ctX1) Random(cy2,ctY1)
IncrX = 12 IncrY = 12
{Random(255,R) Random(255,G) Random(255,B)}
R = 255 G = 60 B = 60
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
ColorFlag = 0
GoSub UpDateMapleLeafCoords
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
X12,Y12,X13,Y13,X14,Y14,X15,Y15,
X16,Y16,X17,Y17,X18,Y18,X19,Y19)
Loop9:
ctX1 = ctX1 + IncrX ctY1 = ctY1 + IncrY
If ctX1 < cx1 Then Negate(IncrX) ColorFlag = 1
If ctY1 < cy1 Then Negate(IncrY) ColorFlag = 1
If ctX1 > cx2 Then Negate(IncrX) ColorFlag = 1
If ctY1 > cy2 Then Negate(IncrY) ColorFlag = 1
GoSub UpDateMapleLeafCoords
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
X12,Y12,X13,Y13,X14,Y14,X15,Y15,
X16,Y16,X17,Y17,X18,Y18,X19,Y19)
If FastDrawFlag = 0 Then WaitInput(1)
R = R - 3 If R < 0 Then R = 255
G = G - 3 If G < 0 Then G = 255
B = B - 3 If B < 0 Then B = 255
UseBrush(SOLID,R,G,B)
UsePen(SOLID,1,B,R,G)
If ColorFlag = 1
Random(255,R) Random(255,G) Random(255,B)
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
ColorFlag = 0
Endif
i = i + 1 j = i % 50
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " polygons drawn"
DrawStatusWintext(1,i$)
Endif
If j = 15 Then WaitInput(1) DrawStatusWinText(1,"Maple leaf has 19 vertices.")
If j = 42 Then WaitInput(1) DrawStatusWinText(1,"Maple leaves ? Hey, we're Canadian !")
Goto Loop9
DrawMapleLeaf2:
DrawStatusWinText(1,"Maple leaves ... hey, we're Canadian !")
If Flag = 0 Then DrawBackGround Flag = 1
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
DrawStatusWinText(0,"Click client area to stop")
Random(cx2,ctX1) Random(cy2,ctY1)
R = 200 G = 110 B = 60
UsePen(SOLID,1,B,R,G)
UseBrush(SOLID,R,G,B)
Loop10:
GoSub UpDateMapleLeafCoords
DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
X12,Y12,X13,Y13,X14,Y14,X15,Y15,
X16,Y16,X17,Y17,X18,Y18,X19,Y19)
If FastDrawFlag = 0 Then WaitInput(1)
R = R + 3 If R > 255 Then Random(255,R)
G = G + 3 If G > 255 Then Random(255,G)
B = B + 3 If B > 255 Then Random(255,B)
UseBrush(SOLID,R,G,B)
UsePen(SOLID,1,B,R,G)
i = i + 1 j = i % 50
If j = 0
WaitInput(1)
Str(i,i$) i$ = i$ + " polygons drawn"
DrawStatusWintext(1,i$)
Endif
If j = 15 Then WaitInput(1) DrawStatusWinText(1,"Maple leaf has 19 vertices.")
If j = 42 Then WaitInput(1) DrawStatusWinText(1,"Maple leaves ? Hey, we're Canadian !")
Random(cx2,ctX1) Random(cy2,ctY1)
Goto Loop10
StopDraw:
If PiXCLMajor = 5 Then FreeArrayVarAll
DrawBackGround
DrawNumber(10,10,i)
Goto Wait_for_Input
UpDateMapleLeafCoords: {subroutine}
X1 = ctX1 + 2 Y1 = ctY1 + 25
X2 = ctX1 + 2 Y2 = ctY1
X3 = ctX1 + 40 Y3 = ctY1 + 10
X4 = ctX1 + 28 Y4 = ctY1 - 5
X5 = ctX1 + 50 Y5 = ctY1 - 45
X6 = ctX1 + 31 Y6 = ctY1 - 38
X7 = ctX1 + 30 Y7 = ctY1 - 58
X8 = ctX1 + 18 Y8 = ctY1 - 34
X9 = ctX1 + 18 Y9 = ctY1 - 68
X10 = ctX1 Y10 = ctY1 - 52
X11 = ctX1 - 18 Y11 = ctY1 - 68
X12 = ctX1 - 18 Y12 = ctY1 - 34
X13 = ctX1 - 30 Y13 = ctY1 - 58
X14 = ctX1 - 31 Y14 = ctY1 - 38
X15 = ctX1 - 50 Y15 = ctY1 - 45
X16 = ctX1 - 28 Y16 = ctY1 - 5
X17 = ctX1 - 40 Y17 = ctY1 + 10
X18 = ctX1 - 2 Y18 = ctY1
X19 = ctX1 - 2 Y19 = ctY1 + 25
Return
UpDateStarCoords: {subroutine}
X1 = ctX1 Y1 = ctY1 - 60
X2 = ctX1 + 36 Y2 = ctY1 + 45
X3 = ctX1 - 54 Y3 = ctY1 - 30
X4 = ctX1 + 54 Y4 = ctY1 - 30
X5 = ctX1 - 36 Y5 = ctY1 + 45
Return